home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / intext1a / frmgolba.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1999-10-05  |  24.7 KB  |  655 lines

  1. VERSION 5.00
  2. Object = "{3B7C8863-D78F-101B-B9B5-04021C009402}#1.2#0"; "RICHTX32.OCX"
  3. Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0"; "COMCTL32.OCX"
  4. Begin VB.Form frmGlobal 
  5.    Caption         =   "Autex. Global In Text Search.  copyright(c) Neil Etherington 1999"
  6.    ClientHeight    =   8310
  7.    ClientLeft      =   60
  8.    ClientTop       =   630
  9.    ClientWidth     =   11880
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   8310
  12.    ScaleMode       =   0  'User
  13.    ScaleWidth      =   11880
  14.    StartUpPosition =   2  'CenterScreen
  15.    WindowState     =   2  'Maximized
  16.    Begin ComctlLib.Toolbar Toolbar1 
  17.       Align           =   1  'Align Top
  18.       Height          =   420
  19.       Left            =   0
  20.       TabIndex        =   18
  21.       Top             =   0
  22.       Width           =   11880
  23.       _ExtentX        =   20955
  24.       _ExtentY        =   741
  25.       ButtonWidth     =   635
  26.       ButtonHeight    =   582
  27.       Appearance      =   1
  28.       ImageList       =   "ImageList1"
  29.       _Version        =   327682
  30.       BeginProperty Buttons {0713E452-850A-101B-AFC0-4210102A8DA7} 
  31.          NumButtons      =   7
  32.          BeginProperty Button1 {0713F354-850A-101B-AFC0-4210102A8DA7} 
  33.             Object.Tag             =   ""
  34.             Style           =   3
  35.             MixedState      =   -1  'True
  36.          EndProperty
  37.          BeginProperty Button2 {0713F354-850A-101B-AFC0-4210102A8DA7} 
  38.             Key             =   "Find"
  39.             Object.ToolTipText     =   "Multiple Search"
  40.             Object.Tag             =   ""
  41.             ImageKey        =   "Find"
  42.          EndProperty
  43.          BeginProperty Button3 {0713F354-850A-101B-AFC0-4210102A8DA7} 
  44.             Key             =   "FindSingle"
  45.             Object.ToolTipText     =   "Single Search"
  46.             Object.Tag             =   ""
  47.             ImageKey        =   "FindSingle"
  48.          EndProperty
  49.          BeginProperty Button4 {0713F354-850A-101B-AFC0-4210102A8DA7} 
  50.             Object.Tag             =   ""
  51.             Style           =   3
  52.             MixedState      =   -1  'True
  53.          EndProperty
  54.          BeginProperty Button5 {0713F354-850A-101B-AFC0-4210102A8DA7} 
  55.             Key             =   "Clear"
  56.             Object.ToolTipText     =   "Clear Data Fields"
  57.             Object.Tag             =   ""
  58.             ImageKey        =   "Clear"
  59.          EndProperty
  60.          BeginProperty Button6 {0713F354-850A-101B-AFC0-4210102A8DA7} 
  61.             Object.Tag             =   ""
  62.             Style           =   3
  63.             MixedState      =   -1  'True
  64.          EndProperty
  65.          BeginProperty Button7 {0713F354-850A-101B-AFC0-4210102A8DA7} 
  66.             Key             =   "TxtSearch"
  67.             Object.ToolTipText     =   "Search For Next Occurrence"
  68.             Object.Tag             =   ""
  69.             ImageKey        =   "TxtSearch"
  70.          EndProperty
  71.       EndProperty
  72.       BorderStyle     =   1
  73.    End
  74.    Begin VB.TextBox txtCount 
  75.       Height          =   285
  76.       Left            =   4680
  77.       TabIndex        =   19
  78.       Text            =   "0"
  79.       Top             =   3000
  80.       Width           =   1095
  81.    End
  82.    Begin ComctlLib.StatusBar StatusBar1 
  83.       Align           =   2  'Align Bottom
  84.       Height          =   375
  85.       Left            =   0
  86.       TabIndex        =   17
  87.       Top             =   7935
  88.       Width           =   11880
  89.       _ExtentX        =   20955
  90.       _ExtentY        =   661
  91.       SimpleText      =   ""
  92.       _Version        =   327682
  93.       BeginProperty Panels {0713E89E-850A-101B-AFC0-4210102A8DA7} 
  94.          NumPanels       =   2
  95.          BeginProperty Panel1 {0713E89F-850A-101B-AFC0-4210102A8DA7} 
  96.             Style           =   6
  97.             Alignment       =   1
  98.             Object.Width           =   1764
  99.             MinWidth        =   1764
  100.             TextSave        =   "10/5/99"
  101.             Object.Tag             =   ""
  102.             Object.ToolTipText     =   "Date"
  103.          EndProperty
  104.          BeginProperty Panel2 {0713E89F-850A-101B-AFC0-4210102A8DA7} 
  105.             Style           =   5
  106.             Alignment       =   1
  107.             Object.Width           =   1764
  108.             MinWidth        =   1764
  109.             TextSave        =   "10:35 PM"
  110.             Object.Tag             =   ""
  111.             Object.ToolTipText     =   "Time"
  112.          EndProperty
  113.       EndProperty
  114.    End
  115.    Begin VB.ComboBox Combo1 
  116.       BeginProperty Font 
  117.          Name            =   "MS Sans Serif"
  118.          Size            =   9.75
  119.          Charset         =   0
  120.          Weight          =   400
  121.          Underline       =   0   'False
  122.          Italic          =   0   'False
  123.          Strikethrough   =   0   'False
  124.       EndProperty
  125.       Height          =   3300
  126.       Left            =   2760
  127.       Style           =   1  'Simple Combo
  128.       TabIndex        =   6
  129.       Top             =   4320
  130.       Width           =   3015
  131.    End
  132.    Begin VB.FileListBox File1 
  133.       Height          =   3210
  134.       Left            =   360
  135.       System          =   -1  'True
  136.       TabIndex        =   5
  137.       Top             =   4440
  138.       Width           =   2175
  139.    End
  140.    Begin VB.DirListBox Dir1 
  141.       Height          =   2790
  142.       Left            =   360
  143.       TabIndex        =   1
  144.       Top             =   1560
  145.       Width           =   2175
  146.    End
  147.    Begin VB.DriveListBox Drive1 
  148.       Height          =   315
  149.       Left            =   360
  150.       TabIndex        =   0
  151.       Top             =   1080
  152.       Width           =   2175
  153.    End
  154.    Begin VB.Frame fmeSearch 
  155.       Caption         =   "Global In Text Search"
  156.       Height          =   7095
  157.       Left            =   240
  158.       TabIndex        =   9
  159.       Top             =   720
  160.       Width           =   5655
  161.       Begin VB.TextBox txtSngCount 
  162.          Height          =   285
  163.          Left            =   4440
  164.          TabIndex        =   21
  165.          Text            =   "0"
  166.          Top             =   3000
  167.          Width           =   1095
  168.       End
  169.       Begin ComctlLib.ProgressBar ProgressBar1 
  170.          Height          =   135
  171.          Left            =   2520
  172.          TabIndex        =   15
  173.          Top             =   600
  174.          Width           =   3015
  175.          _ExtentX        =   5318
  176.          _ExtentY        =   238
  177.          _Version        =   327682
  178.          Appearance      =   1
  179.          Max             =   1000
  180.       End
  181.       Begin VB.TextBox txtFilespec 
  182.          Height          =   285
  183.          Left            =   2520
  184.          TabIndex        =   4
  185.          Text            =   "*.txt"
  186.          Top             =   1560
  187.          Width           =   3015
  188.       End
  189.       Begin VB.CheckBox chkMatchCase 
  190.          Caption         =   "Match Case."
  191.          Height          =   375
  192.          Left            =   2520
  193.          TabIndex        =   3
  194.          ToolTipText     =   "Check This Box If You Want To Match Case"
  195.          Top             =   840
  196.          Width           =   1455
  197.       End
  198.       Begin VB.TextBox txtFilesFound 
  199.          Height          =   285
  200.          Left            =   2520
  201.          TabIndex        =   7
  202.          TabStop         =   0   'False
  203.          Text            =   "0"
  204.          Top             =   2280
  205.          Width           =   1095
  206.       End
  207.       Begin VB.TextBox txtFilesSearched 
  208.          Height          =   285
  209.          Left            =   2520
  210.          TabIndex        =   8
  211.          TabStop         =   0   'False
  212.          Text            =   "0"
  213.          Top             =   3000
  214.          Width           =   1095
  215.       End
  216.       Begin VB.TextBox txtSearchString 
  217.          Height          =   285
  218.          Left            =   2520
  219.          TabIndex        =   2
  220.          ToolTipText     =   "Please Enter String"
  221.          Top             =   240
  222.          Width           =   3015
  223.       End
  224.       Begin VB.Label lblSngCount 
  225.          AutoSize        =   -1  'True
  226.          Caption         =   "Single Count"
  227.          Height          =   195
  228.          Left            =   4440
  229.          TabIndex        =   22
  230.          Top             =   2760
  231.          Width           =   900
  232.       End
  233.       Begin VB.Label lblTxtCount 
  234.          AutoSize        =   -1  'True
  235.          Caption         =   "String Count"
  236.          Height          =   195
  237.          Left            =   4440
  238.          TabIndex        =   20
  239.          Top             =   2040
  240.          Width           =   870
  241.       End
  242.       Begin VB.Label lblFilespec 
  243.          Caption         =   "FileList (FileSpec)."
  244.          Height          =   255
  245.          Left            =   2520
  246.          TabIndex        =   14
  247.          Top             =   1320
  248.          Width           =   1575
  249.       End
  250.       Begin VB.Line Line2 
  251.          BorderColor     =   &H80000005&
  252.          X1              =   2400
  253.          X2              =   2400
  254.          Y1              =   7080
  255.          Y2              =   120
  256.       End
  257.       Begin VB.Line Line1 
  258.          BorderColor     =   &H80000003&
  259.          X1              =   2390
  260.          X2              =   2390
  261.          Y1              =   120
  262.          Y2              =   7080
  263.       End
  264.       Begin VB.Label lblFilesFound 
  265.          AutoSize        =   -1  'True
  266.          Caption         =   "Files Found."
  267.          Height          =   195
  268.          Left            =   2520
  269.          TabIndex        =   13
  270.          Top             =   2040
  271.          Width           =   855
  272.       End
  273.       Begin VB.Label lblFilesSearched 
  274.          AutoSize        =   -1  'True
  275.          Caption         =   "Files In List."
  276.          Height          =   195
  277.          Left            =   2520
  278.          TabIndex        =   12
  279.          Top             =   2760
  280.          Width           =   825
  281.       End
  282.       Begin VB.Label lblSearchString 
  283.          Caption         =   "Search For. (Enter String)."
  284.          Height          =   255
  285.          Left            =   2520
  286.          TabIndex        =   11
  287.          Top             =   0
  288.          Width           =   2175
  289.       End
  290.       Begin VB.Label lblFiles 
  291.          AutoSize        =   -1  'True
  292.          Caption         =   "Files Found With String."
  293.          Height          =   195
  294.          Left            =   2520
  295.          TabIndex        =   10
  296.          Top             =   3360
  297.          Width           =   1680
  298.       End
  299.    End
  300.    Begin RichTextLib.RichTextBox rtBoxMain 
  301.       Height          =   6975
  302.       Left            =   6000
  303.       TabIndex        =   16
  304.       Top             =   840
  305.       Width           =   5655
  306.       _ExtentX        =   9975
  307.       _ExtentY        =   12303
  308.       _Version        =   393217
  309.       ScrollBars      =   3
  310.       TextRTF         =   $"frmGolbal.frx":0000
  311.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  312.          Name            =   "MS Sans Serif"
  313.          Size            =   9.75
  314.          Charset         =   0
  315.          Weight          =   400
  316.          Underline       =   0   'False
  317.          Italic          =   0   'False
  318.          Strikethrough   =   0   'False
  319.       EndProperty
  320.    End
  321.    Begin ComctlLib.ImageList ImageList1 
  322.       Left            =   6000
  323.       Top             =   360
  324.       _ExtentX        =   1005
  325.       _ExtentY        =   1005
  326.       BackColor       =   -2147483643
  327.       ImageWidth      =   16
  328.       ImageHeight     =   16
  329.       MaskColor       =   12632256
  330.       _Version        =   327682
  331.       BeginProperty Images {0713E8C2-850A-101B-AFC0-4210102A8DA7} 
  332.          NumListImages   =   4
  333.          BeginProperty ListImage1 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  334.             Picture         =   "frmGolbal.frx":00AE
  335.             Key             =   "Find"
  336.          EndProperty
  337.          BeginProperty ListImage2 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  338.             Picture         =   "frmGolbal.frx":01C0
  339.             Key             =   "FindSingle"
  340.          EndProperty
  341.          BeginProperty ListImage3 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  342.             Picture         =   "frmGolbal.frx":0452
  343.             Key             =   "TxtSearch"
  344.          EndProperty
  345.          BeginProperty ListImage4 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  346.             Picture         =   "frmGolbal.frx":06E4
  347.             Key             =   "Clear"
  348.          EndProperty
  349.       EndProperty
  350.    End
  351.    Begin VB.Menu mnuFile 
  352.       Caption         =   "&File"
  353.       Begin VB.Menu mnuhyphen 
  354.          Caption         =   "-"
  355.       End
  356.       Begin VB.Menu mnuFileMultipleSearch 
  357.          Caption         =   "Multiple &Search"
  358.          Shortcut        =   ^S
  359.       End
  360.       Begin VB.Menu mnuFileSingleSearch 
  361.          Caption         =   "S&ingle Search"
  362.          Shortcut        =   ^I
  363.       End
  364.       Begin VB.Menu mnuhyphen3 
  365.          Caption         =   "-"
  366.          Index           =   3
  367.       End
  368.       Begin VB.Menu mnuFileExit 
  369.          Caption         =   "E&xit"
  370.          Shortcut        =   ^X
  371.       End
  372.    End
  373.    Begin VB.Menu mnuEdit 
  374.       Caption         =   "&Edit"
  375.       Begin VB.Menu mnuhyphen1 
  376.          Caption         =   "-"
  377.          Index           =   1
  378.       End
  379.       Begin VB.Menu mnuEditFFlist 
  380.          Caption         =   "&Clear Field Lists"
  381.          Shortcut        =   ^C
  382.       End
  383.    End
  384.    Begin VB.Menu mnuFind 
  385.       Caption         =   "Find"
  386.       Begin VB.Menu mnuhyphen5 
  387.          Caption         =   "-"
  388.          Index           =   5
  389.       End
  390.       Begin VB.Menu mnuFindSFNO 
  391.          Caption         =   "Search For Next Occurrence"
  392.          Shortcut        =   ^N
  393.       End
  394.    End
  395.    Begin VB.Menu mnuHelp 
  396.       Caption         =   "&Help"
  397.       Begin VB.Menu mnuhyphen2 
  398.          Caption         =   "-"
  399.          Index           =   2
  400.       End
  401.       Begin VB.Menu mnuHelpAbout 
  402.          Caption         =   "&About"
  403.          Shortcut        =   ^A
  404.       End
  405.    End
  406. Attribute VB_Name = "frmGlobal"
  407. Attribute VB_GlobalNameSpace = False
  408. Attribute VB_Creatable = False
  409. Attribute VB_PredeclaredId = True
  410. Attribute VB_Exposed = False
  411. 'Programmer         Neil Etherington
  412. 'Program Type       Windows Search Engine
  413. 'Program Name       Autex. In File Searcher
  414. 'Commence Date      26.9.99
  415. 'Version No.        v1.1
  416. 'Description        This program will search through a directory of selected files.'
  417. '                   Search within those selected files and add the names of the files
  418. '                   to a combobox if the string that you want to search for is found
  419. '                   within those files. You can then load the files into a richtextbox
  420. '                   by clicking on the selected file. The string that you
  421. '                   searched for will then be selected in the richtextbox.
  422. '                   You can then search for the next string within the richtextbox.
  423. 'If you can understand that description, then have a pint on me, because i can`t and i wrote it.
  424. Option Explicit 'Sets variables before their used
  425. Dim strGsearch As String 'variable for rtboxsearch.text
  426. Dim strFound As String 'Variable that holds the string thats found at gfindposition&
  427. Dim intFileCount As Integer 'Variable that holds the val() of files in the file1.listcount
  428. Dim intListCount As Integer 'Variable that holds the val() of files in the file1.listindex -1
  429. Dim strSearchFor As String 'Variable that holds the string to search for
  430. Dim gCount As Long
  431. Dim gFindrtBox As Long 'Variable that holds the position when searching through the rtboxmain.text
  432. Dim gFindPosition As Long 'Variable that holds the position when searching through the rtboxsearch.text
  433. Private Sub Combo1_Click()
  434. File1.FileName = Combo1.Text 'Sets the filename of file1.filename (Only this name will appear)
  435. txtSngCount.Text = Val(1)
  436. End Sub
  437. Private Sub Dir1_Change()
  438. On Error Resume Next 'Stops error occuring when no cdrom is in the drive
  439. File1.Path = Dir1.Path 'Updates file1.path
  440. End Sub
  441. Private Sub Drive1_Change()
  442. On Error Resume Next 'Stops error occuring when no cdrom is in the drive
  443. Dir1.Path = Drive1.Drive 'Updates dir1.path
  444. End Sub
  445. Private Sub File1_DblClick()
  446. gFindrtBox = Val(0) 'Sets the variable back to val(0) when loading new file into rtboxmain
  447. If File1.ListIndex = -1 Then 'When no file is selected in the file1.list then
  448. MsgBox "Please Select A File To Start The Search From", vbOKOnly, "Autex. In File Searcher."
  449. Else 'If file is selected then
  450.     rtBoxMain.LoadFile modGlobalSearch.GetSelectedFile(Dir1.Path)
  451. End If
  452. txtCount.Text = Val(CountString%) 'Retrieves the value of the countstring function
  453. rtBoxMain.SetFocus
  454. End Sub
  455. Private Sub Form_Load()
  456. File1.Pattern = "*.txt" 'Sets default pattern of file1
  457. 'Combo1.FontBold = True 'Pretty obvious really
  458. rtBoxMain.SelIndent = 50 'Sets a default left indent of rtboxmain
  459. End Sub
  460. Private Sub Form_Resize()
  461. On Error Resume Next 'Stops error occurring when minimize button is clicked
  462. 'Keeps rtboxmain in proportion with frmglobal
  463. With rtBoxMain
  464.     .Height = frmGlobal.Height - 2000
  465.     .Width = frmGlobal.Width - 6500
  466. End With
  467. End Sub
  468. Private Sub mnuEditFFlist_Click()
  469. txtSngCount.Text = Val(0) 'Clears txtsngcount.text
  470. txtCount.Text = Val(0) 'Clears txtcount.text
  471. txtSearchString.Text = "" 'Clears txtsearchstring.text
  472. txtFilesFound.Text = Val(0) 'Clears txtfilesfound.text
  473. txtFilesSearched.Text = Val(0) 'Clears txtfilessearched.text
  474. Combo1.Clear 'Clears combobox
  475. rtBoxMain.Text = "" 'Clears rtboxmain.text
  476. 'These variables are cleared because they will hold their value until the
  477. 'end of the application
  478. strGsearch$ = "" 'Clears strgsearch
  479. strFound$ = "" 'Clears strfound
  480. intFileCount% = Val(0) 'Clears intfilecount
  481. intListCount% = Val(0) 'Clears intlistcount
  482. strSearchFor$ = "" 'Clears strsearchfor
  483. gCount& = Val(0) 'Sets gcount val(0)
  484. gFindrtBox = Val(0) 'Sets gfindrtbox val(0)
  485. gFindPosition = Val(0) 'Sets gfindposition val(0)
  486. File1.Pattern = txtFilespec.Text 'Sets file1.pattern
  487. End Sub
  488. Private Sub mnuFileExit_Click()
  489. Unload Me 'Unload from memory
  490. Close 'Close program
  491. End Sub
  492. Private Sub mnuFileMultipleSearch_Click()
  493. On Error Resume Next 'Stops error occuring when no files are in the file1.listindex
  494. If txtSearchString.Text <= "" Then 'If no string is entered to search for then
  495.     MsgBox "No String Entered Into.(Search For).", vbOKOnly, "Autex. In File Searcher."
  496. Exit Sub
  497. End If
  498. If File1.ListIndex <= -1 Then 'If no file is selected to search from then start at val(0)
  499.     File1.ListIndex = 0
  500. End If
  501. On Error Resume Next 'I`ve tested the program throughly, but you never know
  502. 'Dim strFilesFound As Integer
  503. 'Dim strFilesSearched As Integer
  504. strSearchFor$ = txtSearchString.Text 'AS above
  505. For intFileCount% = 0 To File1.ListCount - 1 'Count how many files are in the filelist
  506.  Next intFileCount%
  507. intListCount% = File1.ListIndex - 1 'As above
  508. Do 'The best bit
  509.     ProgressBar1.Max = Val(intFileCount%)
  510.     ProgressBar1.Value = Val(intListCount%) 'Updates progressbar
  511.         
  512.     Open modGlobalSearch.GetSelectedFile(Dir1.Path) For Binary As 1 'Loadfile into strgsearch$
  513.     strGsearch$ = String(LOF(1), Chr$(0))
  514.     Get 1, , strGsearch$
  515.     Close 1
  516. If chkMatchCase.Value = vbChecked Then 'If matchcase checkbox is cheched then
  517.     strGsearch$ = strGsearch$
  518.     Else 'If it`s not checked then
  519.     strGsearch$ = LCase(strGsearch$)
  520. End If
  521.     gFindPosition& = InStr(strGsearch$, strSearchFor$) 'Find position of strsearchfor$ in rtboxsearch$
  522.     strFound$ = Mid(strGsearch$, gFindPosition&, Len(strSearchFor$)) 'If string found the extract string into strfound$
  523.                                              'For newbies, Like me.  This code does not physicaly remove the string from the file
  524. If strFound$ = strSearchFor$ Then 'If the string is found then
  525.     Combo1.AddItem File1.FileName
  526. End If
  527. intListCount% = intListCount% + 1 'Couldn`t get it to search the last file in the file1.list so i added this code
  528. File1.ListIndex = File1.ListIndex + 1 'Couldn`t get it to search the last file in the file1.list so i added this code
  529. strGsearch$ = "" 'Clear the variable for the next file
  530. strFound$ = "" 'Clear the variable for the next file
  531. DoEvents
  532.     Loop Until intListCount% >= intFileCount% - 1 'Do until no more files are in the file1.list
  533. txtFilesFound = Val(Combo1.ListCount) 'Count how many files are in the combo1 and enter into txtfilesfound
  534. txtFilesSearched = Val(File1.ListCount) 'Count how many files are in the file1 and enter into txtfilessearched
  535. ProgressBar1.Value = 0 'Sets progressbar to val(0) when search finished
  536. File1.ListIndex = 0
  537. MsgBox "Search Completed", vbOKOnly, "Autex. In File Searcher." 'Tells you when all files have been searched
  538. End Sub
  539. 'This is the same as above but searches through the selected file only
  540. Private Sub mnuFileSingleSearch_Click()
  541. On Error Resume Next
  542. If txtSearchString.Text <= "" Then
  543.     MsgBox "No String Entered Into.(Search For).", vbOKOnly, "Autex. In File Searcher."
  544. Exit Sub
  545. End If
  546. If File1.ListIndex <= -1 Then
  547.     File1.ListIndex = 0
  548. End If
  549. On Error Resume Next
  550. strSearchFor$ = txtSearchString.Text
  551. For intFileCount% = 0 To File1.ListCount - 1
  552.  Next intFileCount%
  553. intListCount% = File1.ListIndex - 1
  554.     Open modGlobalSearch.GetSelectedFile(Dir1.Path) For Binary As 1
  555.     strGsearch$ = String(LOF(1), Chr$(0))
  556.     Get 1, , strGsearch$
  557.     Close 1
  558. If chkMatchCase.Value = vbChecked Then
  559.     strGsearch$ = strGsearch$
  560.     Else
  561.     strGsearch$ = LCase(strGsearch$)
  562. End If
  563.     gFindPosition& = InStr(strGsearch$, strSearchFor$)
  564.     strFound$ = Mid(strGsearch$, gFindPosition&, Len(strSearchFor$))
  565. If strFound$ = strSearchFor$ Then
  566.     Combo1.AddItem File1.FileName
  567. End If
  568. intListCount% = intListCount% + 1
  569. File1.ListIndex = File1.ListIndex + 1
  570. strGsearch$ = ""
  571. strFound$ = ""
  572. txtFilesFound = Combo1.ListCount
  573. txtFilesSearched = File1.ListCount
  574. ProgressBar1.Value = 0
  575. If intListCount% >= intFileCount% - 1 Then
  576.     MsgBox "Search Completed", vbOKOnly, "Autex. In File Searcher."
  577. End If
  578. End Sub
  579. Private Sub mnuFindSFNO_Click()
  580. rtBoxMain_GotFocus 'Goto rtboxmain_change(Below)
  581. txtSngCount.Text = txtSngCount.Text + Val(1)
  582. End Sub
  583. Private Sub mnuHelpAbout_Click()
  584. frmAbout.Show
  585. End Sub
  586. Private Sub rtBoxMain_GotFocus()
  587. On Error Resume Next
  588. Dim strStringFor As String 'Variable that holds txtsearchstring
  589. Dim strStringThrough As String 'Variable that holds rtboxmain.text
  590. strStringFor$ = txtSearchString.Text 'As above
  591. If chkMatchCase.Value = vbChecked Then 'If chkmatchcase.value = vbchecked then
  592.     strStringThrough$ = rtBoxMain.Text
  593. Else 'If it isn`t checked then
  594.     strStringThrough$ = LCase(rtBoxMain.Text)
  595. End If
  596. gFindrtBox& = InStr(gFindrtBox& + 1, strStringThrough$, strStringFor$) 'Finds position (As above)
  597. If gFindrtBox& <= 0 Then 'If no more strings are found then
  598.     MsgBox "Sorry: Their Are No More Occurrence Of The Word. " & vbCrLf & vbCrLf _
  599.     & "                         ----- " & strStringFor$ & " -----", vbOKOnly, "Autex. In File Searcher"
  600.     txtSngCount.Text = Val(-1)
  601. Exit Sub
  602. End If
  603. rtBoxMain.SelStart = gFindrtBox& - 1 'Sets the start position in rtboxmain
  604. rtBoxMain.SelLength = Len(strStringFor$) 'Sets the length of text to be highlighted in rtboxmain
  605. rtBoxMain.SetFocus
  606. End Sub
  607. 'This code just operates the buttons on the toolbar
  608. Private Sub Toolbar1_ButtonClick(ByVal Button As ComctlLib.Button)
  609. Select Case Button.Key
  610.     Case "Find"
  611.         mnuFileMultipleSearch_Click
  612.     Case "FindSingle"
  613.         mnuFileSingleSearch_Click
  614.     Case "Clear"
  615.         mnuEditFFlist_Click
  616.     Case "TxtSearch"
  617.         rtBoxMain_GotFocus
  618.     If Toolbar1.Buttons("TxtSearch").Value = tbrUnpressed Then
  619.         txtSngCount.Text = txtSngCount.Text + Val(1)
  620.     End If
  621. End Select
  622. End Sub
  623. Private Sub txtFilespec_Change()
  624. File1.Pattern = txtFilespec.Text
  625. End Sub
  626. Private Sub txtSearchString_KeyDown(KeyCode As Integer, Shift As Integer)
  627. If KeyCode = 13 Then
  628.     mnuFileMultipleSearch_Click
  629. End If
  630. End Sub
  631. 'This function will search the the text file while it loads into the
  632. 'richtextbox and count how many occurrance of the word you searched for are
  633. 'in the string. Its very similar to the code in the global search so i won`t
  634. 'add comments
  635. Private Function CountString() As Integer
  636. Dim intStringCount As Integer
  637. Dim strStringA As String
  638. Dim strStringB As String
  639. strStringA$ = LCase(rtBoxMain.Text)
  640. strStringB$ = txtSearchString.Text
  641. txtCount.Text = ""
  642. gCount& = Val(0)
  643.     gCount& = InStr(gCount& + 1, strStringA$, strStringB$)
  644.     If gCount& <= 0 Then
  645.     Exit Function
  646.     End If
  647.         
  648.     strFound$ = Mid(rtBoxMain.Text, gCount&, Len(txtSearchString.Text))
  649.     If strFound$ >= " " Then
  650.         intStringCount% = intStringCount% + 1
  651.     End If
  652. CountString% = Val(intStringCount%)
  653. DoEvents
  654. End Function
  655.